<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
     <%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
     <%@taglib uri="http://struts.apache.org/tags-nested" prefix="nested" %>
     <%@taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
     <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<!DOCTYPE html>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="/OnOffLine/js/external/jquery-1.7.1.js"></script>
<script type="text/javascript" src="/OnOffLine/js/external/moment.js"></script>
<script type="text/javascript" src="/OnOffLine/js/external/jquery.getUrlParam.js"></script>
<script type="text/javascript" src="/OnOffLine/js/offline.js"></script>
<script type="text/javascript" src="/OnOffLine/js/db.js"></script>
<title>View</title>
<link rel="stylesheet" type="text/css" href="/OnOffLine/css/style.css" />
</head>

<body id="view-page">

<div class="top-menu">
	<div class="left-item"><a href="/OnOffLine/">OnOffLine</a></div>
		
	<div class="right-item">		
		<div class="center-block"><a id="createtop" title="Create new note" href="/OnOffLine/blog.do?method=create"><img alt="create new note" src="/OnOffLine/images/mail.png" /></a></div>
		<div class="right-block"><a href="#">sign out</a></div>
	</div>
</div>


<div class="main">

	<div class="left">
		<img class="logo" src="/OnOffLine/images/logo2.png" alt="logo" />
		<img class="ico-pencil" src="/OnOffLine/images/pencil.png" alt="logo" />
			 
		<ul class="left-menu">
			<li><a id="myblogs" class="link" href="/OnOffLine/blog.do?method=myBlogs">my notes</a></li>
			<li><a id="create" class="link" href="/OnOffLine/blog.do?method=create">create</a></li>
		</ul>
	</div>
	
	<div class="right">
		<div class="inner">
		
			<div class="blog-template x-hidden">
				<div class="note-item">
					<span class="icon"><img src="/OnOffLine/images/attachment.png" /></span>
					<span class="title"></span>
					<span class="date">Created on </span>
					<a class="button blue small edit" href="/OnOffLine/jsp/create_offline.jsp#some?method=edit&id=">Edit</a>
					<a class="button black small delete" href="/OnOffLine/">Delete</a>
					<span class="description"></span>
					<input type="hidden" name="id" />
				</div>
			</div>
			
			<div class="blogs"></div>			
		</div>
	</div>
</div>

<script>
$(function(){
	if (dbSupport){
		
		var hash = window.location.hash;
		var start = hash.indexOf('id=');
		var id = hash.substring(start + 3);
		
		$('a.edit').live('click', function(){			
			window.location.href = $(this).attr('href');
			return false;
		});
		
		
		$('a.delete').live('click', function(){
			deleteBlog(id, function(){
				window.location.href = '/OnOffLine/jsp/my_blogs.jsp';
			});
			return false;
		});
		
		
		if (id){
			renderBlogs(id);
		}
	}
});
</script>

</body>
</html>